using UnityEngine;

public class FaceToCamera : MonoBehaviour
{
    [SerializeField]
    private Camera _targetCamera;
    [SerializeField]
    bool flip = false;
    public Camera TargetCamera { get => _targetCamera; set => _targetCamera = value; }
    private void Awake()
    {
        if (_targetCamera == null)
        {
            _targetCamera = Camera.main;
        }
    }
    void Update()
    {
        transform.forward = flip ? -TargetCamera.transform.forward : TargetCamera.transform.forward;
    }
}
